import { Http } from '@/common/api'

/**
 * 保存基本信息
 * @param param
 * @return {*|Promise}
 */
export const apiPostAddBase = async (param) => Http.post('/srm/supplier/add', param)

/**
 * 修改基本信息
 * @param param
 * @return {*|Promise}
 */
export const apiPostUpdateBase = async (param) => Http.put('/srm/supplier/update', param)

/**
 * 查询基本信息
 * @param id
 * @return {*|Promise}
 */
export const apiGetBase = async (id) => Http.get(`/srm/supplier/findById/${id}`)

/**
 * 保存法人信息
 * @param param
 * @return {*|Promise}
 */
export const apiPostAddCorporation = async (param) => Http.post('/srm/supplier/corporation/add', param)

/**
 * 修改法人信息
 * @param param
 * @return {*|Promise}
 */
export const apiPostUpdateCorporation = async (param) => Http.put('/srm/supplier/corporation/update', param)
/**
 * 查询法人信息
 * @param id
 * @return {*|Promise}
 */
export const apiGetCorporation = async (supplierId) =>
  Http.get(`/srm/supplier/corporation/findBySupplierId/${supplierId}`)

/**
 * 保存负责人信息
 * @param param
 * @return {*|Promise}
 */
export const apiPostAddLiaison = async (param) => Http.post('/srm/supplier/liaison/add', param)

/**
 * 修改负责人信息
 * @param param
 * @return {*|Promise}
 */
export const apiPostUpdateLiaison = async (param) => Http.put('/srm/supplier/liaison/update', param)

/**
 * 查询负责人信息
 * @param id
 * @return {*|Promise}
 */
export const apiGetLiaison = async (supplierId) => Http.get(`/srm/supplier/liaison/findBySupplierId/${supplierId}`)

/**
 * 保存股本结构信息
 * @param param
 * @return {*|Promise}
 */
export const apiPostAddCapital = async (param) => Http.post('/srm/supplier/capital/add', param)

/**
 * 修改股本结构信息
 * @param param
 * @return {*|Promise}
 */
export const apiPostUpdateCapital = async (param) => Http.put('/srm/supplier/capital/update', param)

/**
 * 查询股本结构信息
 * @param id
 * @return {*|Promise}
 */
export const apiGetCapital = async (supplierId) => Http.get(`/srm/supplier/capital/findBySupplierId/${supplierId}`)

/**
 * 保存发票信息
 * @param param
 * @return {*|Promise}
 */
export const apiPostAddInvoice = async (param) => Http.post('/srm/supplier/invoice/add', param)

/**
 * 修改发票信息
 * @param param
 * @return {*|Promise}
 */
export const apiPostUpdateInvoice = async (param) => Http.put('/srm/supplier/invoice/update', param)

/**
 * 查询发票信息
 * @param id
 * @return {*|Promise}
 */
export const apiGetInvoice = async (supplierId) => Http.get(`/srm/supplier/invoice/findBySupplierId/${supplierId}`)

/**
 * 保存银行信息
 * @param param
 * @return {*|Promise}
 */
export const apiPostAddBank = async (param) => Http.post('/srm/supplier/bank/add', param)

/**
 * 修改银行信息
 * @param param
 * @return {*|Promise}
 */
export const apiPostUpdateBank = async (param) => Http.put('/srm/supplier/bank/update', param)

/**
 * 查询银行信息
 * @param id
 * @return {*|Promise}
 */
export const apiGetBank = async (supplierId) => Http.get(`/srm/supplier/bank/findById/${supplierId}`)

export const apiGetSubmit = async (supplierId) => Http.get(`/srm/supplier/submit?id=${supplierId}`)
/**
 * 人员信息
 * @param id
 * @return {*|Promise}
 */
// 列表
export const apiPostStaffPageApi = '/srm/supplier/staff/page'
// 新增
export const apiPostStaffAdd = async (data) => Http.post('/srm/supplier/staff/add', data)
export const apiPutStaffUpdate = async (parmas) => Http.put('/srm/supplier/staff/update', parmas)
export const apiDeleteStaffDelete = async (id) => Http.delete(`/srm/supplier/staff/delete?id=${id}`)
export const apiGetStaffFindById = async (id) => Http.get(`/srm/supplier/staff/findById/${id}`)

// 区域
export const apiPostAreaTree = async (params) => Http.post('/upms/area/tree', params)

// 主供服务类型
export const apiPostGetServiceType = async (params) => Http.post('/srm/type/tree', params)

// 证书弹窗
// 证书人员查询
export const supplierStaffUrl = '/srm/supplier/staff/cert/page'
export const apiStaffCertPage = async (params) => Http.post('/srm/supplier/staff/cert/page', params)
// 新增
export const apiStaffCertAdd = async (params) => Http.post('/srm/supplier/staff/cert/add', params)
// 更新
export const apiStaffCertUpdate = async (params) => Http.put('/srm/supplier/staff/cert/update', params)
// 查询
export const apiStaffCertFindById = async (id) => Http.get(`/srm/supplier/staff/cert/findById/${id}`)
// 删除
export const apiStaffCertDelete = async (id) => Http.delete(`/srm/supplier/staff/cert/delete?id=${id}`)

// 特种人员--查询
export const supplierStaffSpecialUrl = '/srm/supplier/staff/special/page'

export const apiStaffSpecialPage = async (params) => Http.post('/srm/supplier/staff/special/page', params)
// 新增
export const apiStaffSpecialAdd = async (params) => Http.post('/srm/supplier/staff/special/add', params)
// 更新
export const apiStaffSpecialUpdate = async (params) => Http.put('/srm/supplier/staff/special/update', params)
// 查询
export const apiStaffSpecialFindById = async (id) => Http.get(`/srm/supplier/staff/special/findById/${id}`)
// 删除
export const apiStafSpecialfDelete = async (id) => Http.delete(`/srm/supplier/staff/special/delete?id=${id}`)

// 人员职称
export const supplierStaffTitleUrl = '/srm/supplier/staff/title/page'

export const apiStaffTitlePage = async (params) => Http.post('/srm/supplier/staff/title/page', params)
// 新增
export const apiStaffTitleAdd = async (params) => Http.post('/srm/supplier/staff/title/add', params)
// 更新
export const apiStaffTitleUpdate = async (params) => Http.put('/srm/supplier/staff/title/update', params)
// 查询
export const apiStaffTitleFindById = async (id) => Http.get(`/srm/supplier/staff/title/findById/${id}`)
// 删除
export const apiStaffTitleDelete = async (id) => Http.delete(`/srm/supplier/staff/title/delete?id=${id}`)
